<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>使用套餐</title>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="validator"
	uri="http://www.springmodules.org/tags/commons-validator"%>
<core:set var="webcontext" scope="request"
	value="${pageContext.request.contextPath}" />
<core:set var="imagepath" scope="request" value="${webcontext}/images" />
<core:set var="csspath" scope="request" value="${webcontext}/css" />
<core:set var="jspath" scope="request" value="${webcontext}/javascript" />
<core:set var="jsppath" scope="request" value="${webcontext}/jsp" />
<core:set var="htmlpath" scope="request" value="${webcontext}/html" />
<core:set var="bootstrapPath" scope="request"
	value="${webcontext}/bootstrap" />
<core:set var="layerPath" scope="request" value="${webcontext}/layer" />
<!-- TODO the gdms url should replace by the token -->
<core:set var="gdmsurl" scope="request"
	value="@token-gdms.server.servlet.context.url.integration@" />
<script type="text/javascript">
	var contextPath = "${webcontext}";
</script>
<%@page import="com.cap.bts.framework.common.util.Pager"%>
<%@page import="com.cap.bts.framework.common.constant.CommonConstants"%>
<%@page import="com.cap.bts.framework.common.util.CodeTextUtils"%>
<%@page import="com.cap.bts.framework.common.util.CookieUtils"%>
<%@page import="com.cap.bts.framework.auth.constant.AuthConstant"%>


<link rel="stylesheet" type="text/css" href="${csspath }/public.css" />
<script type="text/javascript" src="${jspath }/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${jspath }/../layer/layer.js"></script>
</head>
<style type="text/css">
.formError .formErrorContent {
	-moz-border-radius: 6px 6px 6px 6px;
	-moz-box-shadow: 0 0 6px #000000;
	background: none repeat scroll 0 0 #EE0101;
	border: 2px solid #DDDDDD;
	color: #FFFFFF;
	font-family: tahoma;
	font-size: 11px;
	padding: 4px 10px;
	width: 100px;
}
html, body {
    font: 12px "Microsoft YaHei","Microsoft YaHei",Verdana,Arial,sans-serif;
    color: #000;
    overflow: auto;
}

tr {
height:35px;
}

.data_tab tr.over td {
	color: #000;
	font-weight: bold;
	background-color: #fff;
}

.data_tab tr.over td a {
	background: url("/crm/images/menu/title_bg.jpg") repeat-x;
}

.align_m {
	border: 0px solid #EBEBEB;
	color: #000;
}

.align_l {
	background-color: #5cb85c;
}
.tr_lign_l td{
	color: #FFF;
}

.align_w {
	border: 1px solid #EBEBEB;
	background-color: #EBEBEB;
	color: #000;
}

.data_tab tr.over .align_l {
	background-color: #c9e8f7;
}

.data_tab tr.over .align_m {
	background-color: #fff;
	font-weight: normal;
}

.data_tab tr.over .align_w {
	background-color: #EBEBEB;
	font-weight: normal;
}

.hasUsed {
	color: #666666;
}

.hr {
	text-align: center;
	width: 100%;
	background-color: #96c2f1;
	height: 1px;
}

dl {
	clear: left;
}

dt, dd {
	float: left;
}

tr .ticket{
	background-color: #D0E9C6;
}

.send-code,.michelin-btn
{background-color:#5cb85c; color:#FFF; border:none;padding: 3px 5px;margin-left:0px;}
.send-code-disabled {background-color: #CEC7C7 !important;color: #000 !important;}

.code-input{font-weight:bold; width: 75px; text-align:center;height:20px;border: 1px solid #DACBCB;}
.description-input{background-color: #FFF; height:23px;    border: 1px solid #E0DDDD;}

.mt tr{
border-bottom:1px solid #DCD8D8;
}
.text-r{text-align: right;}

.ticket{border-top: 1px solid #fff; }
.ticket td{text-align: center; height:35px; }
.tc{text-align:center;}
</style>

<script type="text/javascript">
	$(function() {
		//选中后该行高亮
		$('#table tr').bind('click', function() {
			
			if (window.cur)
				window.cur.style.background = "";
			if (window.cur)
				window.cur.style.fontWeight = "normal";
			if (window.cur){
				$(window.cur).find("td").css("color","#000");
			}
			this.style.background = "#66CCCC";
			window.cur = this;
			$(this).find("td").css("color","#fff");
			var tmpCheckBox = $(this).find("td input[type='checkbox']");
			var checkFlag = tmpCheckBox.prop("checked");
			if(!checkFlag){
				tmpCheckBox.prop("checked",true);
			}else{
				tmpCheckBox.prop("checked",false);
			}
		});
		$("table tr input[type='checkbox']").on('click',function(event){
			var radio = $(this);
			radio.prop("checked", !radio.prop("checked"));			
			return;
		});
		
		$('.data_tab .tr_lign_l').bind('click', function() {
			if (window.cur)
				window.cur.style.background = "";
			if (window.cur)
				window.cur.style.fontWeight = "normal";
			window.cur = this;
		});

		$("#data_tab .tr_lign_l").click(function() {
			$(this).next().toggle();
		});

		$("#redeemItems").click(function() {
			$("#msg").html("<img src='${imagepath}/loading2.gif' />处理中...");
			$("#redeemItems").toggle();
			$.ajax({
				type : 'POST',
				url : '${webcontext}/MARS/usePackageItem',
				async : false,
				data : $("form").serialize(),
				dataType : 'json',
				success : function(data) {
					if (data.result== true) {
						$("#msg").html("操作成功，请关闭页面");
					} else {
						$("#msg").html(data.errorMsg);
						$("#redeemItems").toggle();
					}
				},
				error : function(data) {
					$("#msg").html("操作失败，请刷新后重试");
				}
			});
		});

	});

	function sendMessage(id, detailId, source) {
		
		var confirmIndex = layer.confirm('确定发送短信抵扣码?', {offset : ['250px', '350px']}, function(index){
			layer.close(confirmIndex);
			var loadIndex = layer.load(1, {
			    shade: [0.5,'#000'],
				offset : ['250px', '450px']
			});
			
			$.ajax({
				type : 'POST',
				url : '${webcontext}/MARS/sendRedemptionCode',
				async : true,
				data : "memberPackageId=" + id + "&redemptionId=" + detailId,
				dataType : 'json',
				success : function(data) {
					layer.close(loadIndex);
					if (data== true) {
						layer.alert("抵扣码发送成功！", {
						    icon: 1,
						    offset : ['250px', '350px']
						});
						
						var $source = $(source);
						$source.prop({disabled: true});
						$source.addClass('send-code-disabled');
						countdown($source, 60);
					} else {
						layer.alert("抵扣码发送失败，请重试！", {
						    icon: 2,
						    offset : ['250px', '350px']
						});
					}
				},
				error : function(data) {
					layer.close(loadIndex);
					layer.alert("请求失败,请重试！", {
					    icon: 2,
					    offset : ['250px', '350px']
					});
				}
			});
		});      
		
	}
	
	
	function countdown($source, lastCount){
		$source.val(lastCount - 1 + "秒后重发");
		if(lastCount > 1){
			setTimeout(function(){
				countdown($source, lastCount - 1);
			}, 1000);
		}else if(lastCount <= 1){
			$source.prop({disabled: false});
			$source.removeClass('send-code-disabled');
			$source.val("重发抵扣码");
		}
		
		
	}
	
	var g_itemIndex = 0;
	
	function toItemTypeInfoList(itemId,ticketId,packageId){
		var loadIndex = layer.load(1, {
		    shade: [0.5,'#000'],
			offset : ['250px', '450px']
		});
		$.ajax({
			type : 'POST',
			url : "${webcontext}/MARS/toWecareItemTypeInfoList?itemId="+itemId+"&ticketId="+ticketId+"&packageId="+packageId+"&serverCenter="+$("#dealerIdHtxt").val(),//iframe的url,
			async : true,
			dataType : 'html',
			success : function(data) {
				layer.close(loadIndex);
				
				if(data.indexOf("系统错误，请联系系统管理员") > 0){
					layer.alert("请求失败,请重试！", {
					    icon: 2,
					    offset : ['10px', '350px']
					});
					
					return;
				}
				//iframe层
			g_itemIndex =	layer.open({
				    type: 1,
				    title: '商品列表',
				    scrollbar:true,
				    shadeClose: false,
				    move: false,
				    closeBtn: 1,
				    shade: 0.1, 
				    offset : ['10px', '100px'],
				    area: ['800px', '800px'],
				    //content: "${webcontext}/MARS/toWecareItemTypeInfoList?itemId="+itemId+"&ticketId="+ticketId+"&packageId="+packageId+"&serverCenter="+$("#dealerIdHtxt").val(),//iframe的url
				    content: "<div id='itemBox'>" + data + "</div>",//iframe的url
				    end: function(){ 
				    	//关闭弹出层后回调方法
				    }
				}); 
			},
			error : function(data) {
				layer.close(loadIndex);
				layer.alert("请求失败,请重试！", {
				    icon: 2,
				    offset : ['10px', '350px']
				});
			}
		});
		
		
		
	}
	
	function returnFalse(){
		event.stopPropagation();
		return false;
	}
</script>
<body style="overflow-y:auto;">
	<div class="container-fluid" style="padding:3px">
		<div class="row-fluid">
			<div class="span12">
				<form:form id="show_form" action="#" method="post"
					modelAttribute="dto">
					<input type="hidden" id="memberIdHtxt" name="id"
						value="${memberInfo.id}">
					<input type="hidden" id="mobilePhoneHtxt" name="mobilePhone"
						value="${memberInfo.mobilePhone}">
					<input type="hidden" id="memberNameHtxt" name="memberName"
						value="${memberInfo.memberName}">
					<input type="hidden" id="carPlateHtxt" name="carPlate"
						value="${memberInfo.carPlate}">
					<input type="hidden" id="dealerIdHtxt" name="dealerId"
						value="${memberInfo.dealerId}">
					<input type="hidden" id="soNumberHtxt" name="soNumber"
						value="${memberInfo.soNumber}">
					<table id="data_tab" class="table" width="950px">
						<thead>
							<tr>
								<th>套餐类型</th>
								<th>卡号</th>
								<th>购买日期</th>
								<th>激活日期</th>
								<th>失效日期</th>
								<th>状态</th>
							</tr>
						</thead>
						<tbody>
							<core:forEach items="${memberPackageInfoList}" var="list"
								varStatus="listStatus">
								<tr class="tr_lign_l " style="background-color: #5CB85C; color: #FFF;">
									<td class="tc">${list.name}</td>
									<td class="tc">${list.packageNumber}</td>
									<td class="tc">${list.purchaseDate}</td>
									<td class="tc">${list.activeDate}</td>
									<td class="tc">${list.expireDate}</td>
									<td class="tc"><core:choose>
											<core:when test="${list.status==0}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 0)%>
											</core:when>
											<core:when test="${list.status==1}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 1)%>
											</core:when>
											<core:when test="${list.status==2}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 2)%>
											</core:when>
											<core:when test="${list.status==3}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 3)%>
											</core:when>
											<core:when test="${list.status==4}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 4)%>
											</core:when>
											<core:when test="${list.status==5}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 5)%>
											</core:when>
											<core:when test="${list.status==6}">
												<%=CodeTextUtils.getText("MemberPackageInfo.Status", 6)%>
											</core:when>
										</core:choose></td>
								</tr>
								<core:choose>
									<core:when test="${list.status ==2}">
										<tr id="packageDetail${list.id}Tr">
									</core:when>
									<core:otherwise>
										<tr id="packageDetail${list.id}Tr" style="display: none">
									</core:otherwise>
								</core:choose>
								<td></td>
								<td colspan="5">
									<table id="table" style="border-top:none;border-top-color:#FFF; width:100%;">
										<core:choose>
											<core:when test="${list.hasUnused and list.hasUsed}">
											<tr>
													<th width="80px">是否使用</th>
													<th width="150px">可用项目</th>
													<th width="125px">描述</th>
													<th width="130px">可使用次数</th>
													<th width="200px">抵扣码</th>
												</tr>
												<core:forEach
													items="${list.memberPackageRedemptionListMars}"
													var="detailList" varStatus="detailListStatus">
													<!-- Mars使用参数:套餐Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].packageId"
														type="hidden" value="${list.id}" />
													<!-- Mars使用参数:套餐使用项目Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemptionId"
														type="hidden" value="${detailList.redemptionId}" />
													<!-- Mars使用参数:套餐定义行Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].lineId"
														type="hidden" value="${detailList.lineId}" />
													<!-- Mars使用参数:套餐剩余项目数 -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].countOfPackageLines"
														type="hidden" value="${detailList.countOfPackageLines}" />	
													<tr class="ticket">
														<core:if test="${list.status == 4}">
															<td class="align_m" align="center">
																<span style="color:red;font-size:12px;">不可使用</span>
															</td>
														</core:if>
														<core:if test="${list.status != 4}">
															<td class="align_m" align="center"><input
																	type="checkbox"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].isRedeemItem" /></td>
														</core:if>
														<td class="align_m" align="left">${detailList.ticketName}</td>
														<td class="align_m" align="left">${detailList.description}</td>
														<td class="text-right" style="padding-right: 40px;">${detailList.useTimes}</td>
														<core:if test="${detailList.hasVerificationCode == 'Y'}">
															<td class="text-r" onclick="returnFalse();">
															<core:if test="${list.status != 4}">
																<input name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].countOfPackageLines" type="hidden" value="${list.countOfPackageLines}" />
																	<!-- Mars使用参数:套餐定义抵扣码--> <input type="text" class="code-input"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].activicationCode"
																	/>
																<input type="hidden"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].hasVerificationCode"
																	value="Y"/>
																	<input
																	id="sendCode${list.id}Detail${detailList.redemptionId}Btn"
																	type="button" class="send-code"
																	onClick="sendMessage('${list.id}','${detailList.redemptionId}', this)"
																	value="发送抵扣码" />
															</core:if>
															</td>
														</core:if>
														<core:if test="${detailList.hasVerificationCode == 'N'}">
															<td class="text-left">无需抵扣码
															</td>
														</core:if>
													</tr>
													<tr>
													  <td colspan="5">
															<table width="100%" class="mt">
																<!-- <tr>
																	<th width="150">商品名称</th>
																	<th>商品描述</th>
																	<th width="60">数量</th>
																	<th width="60">金额</th>
																</tr> -->
																<core:forEach items="${detailList.redemtionItemList}"
														var="detailListItem" varStatus="detailItemListStatus">
														<!-- MemberPackageRedemptionItemDto -->
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemId" value="${detailListItem.itemId}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemName" value="${detailListItem.itemName}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].quantity" value="${detailListItem.quantity}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].price" value="${detailListItem.price}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionMethod" value="${detailList.deductionMethod}"/>
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionAmount" value="${detailList.deductionAmount}"/>
														<tr>
															<td width="150">${detailListItem.itemName}</td>
															<td>
																<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].hasEligibilityDefine" value="${detailListItem.hasEligibilityDefine }">
																<input type="hidden"  id="itemCode${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemNo">
																<input type="hidden" id="itemFamily${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemFamily">
																<input type="hidden" id="itemSource${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemSource" >
															<core:if test="${detailListItem.hasEligibilityDefine eq 1 and list.status != 4}">
																	<input placeholder="请选择商品" style="width:100%;display:inline;" class="description-input" onclick="toItemTypeInfoList('${detailListItem.itemId }','${detailList.redemptionId }','${list.id }')" id="itemDescription${list.id }${detailList.redemptionId }${detailListItem.itemId }" readonly>
																</core:if>
															</td>
															<td align="center" width="60">${detailListItem.quantity}</td>
															<td align="center" width="60">${detailListItem.price ne null ? '￥':''}${detailListItem.price}</td>
														</tr>
													</core:forEach>
															</table>
														</td>
													</tr>
													<%-- <tr>
														<th></th>
														<th>商品名称</th>
														<th>商品描述</th>
														<th>数量</th>
														<th>金额</th>
													</tr>
													<core:forEach items="${detailList.redemtionItemList}"
														var="detailListItem" varStatus="detailItemListStatus">
														<!-- MemberPackageRedemptionItemDto -->
														
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemId" value="${detailListItem.itemId}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemName" value="${detailListItem.itemName}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].quantity" value="${detailListItem.quantity}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].price" value="${detailListItem.price}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionMethod" value="${detailList.deductionMethod}"/>
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionAmount" value="${detailList.deductionAmount}"/>
														<tr>
															<td></td>
															<td>${detailListItem.itemName}</td>
															<td>
															<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].hasEligibilityDefine" value="${detailListItem.hasEligibilityDefine }">
															<input type="hidden"  id="itemCode${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemNo">
																	<input style="width:100px;display:inline;" id="itemDescription${list.id }${detailList.redemptionId }${detailListItem.itemId }" disabled>
																	<input type="hidden" id="itemFamily${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemFamily">
																	<input type="hidden" id="itemSource${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemSource" >
																	<a href="javascript:void(0)" onclick="toItemTypeInfoList('${detailListItem.itemId }','${detailList.redemptionId }','${list.id }')">编辑</a>
																	</td>
															<td align="center">${detailListItem.quantity}</td>
															<td align="center">${detailListItem.price}</td>
														</tr>
													</core:forEach> --%>
												</core:forEach>
												<tr>
													<th>已用项目</th>
													<th>描述</th>
													<th>已使用次数</th>
													<th>使用日期</th>
													<th></th>
												</tr>
												<core:forEach
													items="${list.memberUsedPackageRedemptionList}"
													var="usedDetailList">
													<tr>
														<td class="align_w hasUsed tc">${usedDetailList[2]}</td>
														<td class="align_w hasUsed tc">${usedDetailList[3]}</td>
														<td class="align_w hasUsed tc"
															style="padding-right: 40px;">${usedDetailList[4]}</td>
														<td class="align_w hasUsed tc" align="left"><fmt:formatDate
																value="${usedDetailList[6]}"
																pattern="yyyy-MM-dd HH:mm:ss" var="redeemDate" />
															${fn:substring(redeemDate, 0, 10)}</td>
														<td class="align_w hasUsed" ></td>
													</tr>
												</core:forEach>
											</core:when>
											<core:when test="${list.hasUnused}">
												<tr>
													<th width="80px">是否使用</th>
													<th width="105px">可用项目</th>
													<th width="125px">描述</th>
													<th width="130px">可使用次数</th>
													<th width="200px">抵扣码</th>
												</tr>
												<core:forEach
													items="${list.memberPackageRedemptionListMars}"
													var="detailList" varStatus="detailListStatus">
													<!-- Mars使用参数:套餐Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].packageId"
														type="hidden" value="${list.id}" />
													<!-- Mars使用参数:套餐使用项目Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemptionId"
														type="hidden" value="${detailList.redemptionId}" />
													<!-- Mars使用参数:套餐定义行Id -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].lineId"
														type="hidden" value="${detailList.lineId}" />
													<!-- Mars使用参数:套餐剩余项目数 -->
													<input
														name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].countOfPackageLines"
														type="hidden" value="${detailList.countOfPackageLines}" />	
													<tr class="ticket">
														<core:if test="${list.status == 4}">
															<td class="align_m" align="center">
																<span style="color:red;font-size:12px;">不可使用</span>
															</td>
														</core:if>
														<core:if test="${list.status != 4}">
															<td class="align_m" align="center"><input
																	type="checkbox"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].isRedeemItem" /></td>
														</core:if>
														<td class="align_m" align="left">${detailList.ticketName}</td>
														<td class="align_m" align="left">${detailList.description}</td>
														<td class="text-right" >${detailList.useTimes}</td>
														<core:if test="${detailList.hasVerificationCode == 'Y'}">
															<td class="text-r" onclick="returnFalse();">
															<core:if test="${list.status != 4}">
																<input name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].countOfPackageLines" type="hidden" value="${list.countOfPackageLines}" />
																	<!-- Mars使用参数:套餐定义抵扣码--> <input type="text"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].activicationCode"
																	class="code-input"/>
																	<input type="hidden"
																	name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].hasVerificationCode"
																	value="Y"/>
																	<input
																	id="sendCode${list.id}Detail${detailList.redemptionId}Btn"
																	type="button" class="send-code"
																	onClick="sendMessage('${list.id}','${detailList.redemptionId}', this)"
																	value="发送抵扣码" />
															</core:if>
															</td>
														</core:if>
														<core:if test="${detailList.hasVerificationCode == 'N'}">
															<td class="text-left">无需抵扣码
															</td>
														</core:if>
													</tr>
													<tr>
													  <td colspan="5">
															<table width="100%" class="mt">
																<!-- <tr>
																	<th width="150">商品名称</th>
																	<th>商品描述</th>
																	<th width="60">数量</th>
																	<th width="60">金额</th>
																</tr> -->
																<core:forEach items="${detailList.redemtionItemList}"
														var="detailListItem" varStatus="detailItemListStatus">
														<!-- MemberPackageRedemptionItemDto -->
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemId" value="${detailListItem.itemId}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemName" value="${detailListItem.itemName}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].quantity" value="${detailListItem.quantity}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].price" value="${detailListItem.price}" />
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionMethod" value="${detailList.deductionMethod}"/>
														<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].deductionAmount" value="${detailList.deductionAmount}"/>
														<tr>
															<td width="150">${detailListItem.itemName}</td>
															<td>
																<input type="hidden" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].hasEligibilityDefine" value="${detailListItem.hasEligibilityDefine }">
																<input type="hidden"  id="itemCode${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemNo">
																<input type="hidden" id="itemFamily${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemFamily">
																<input type="hidden" id="itemSource${list.id }${detailList.redemptionId }${detailListItem.itemId }" name="packageListDto[${listStatus.index}].redeemList[${detailListStatus.index}].redemtionItemList[${detailItemListStatus.index}].itemSource" >
																<core:if test="${detailListItem.hasEligibilityDefine eq 1 and list.status != 4}">
																	<input placeholder="请选择商品" style="width:100%;display:inline;" class="description-input" onclick="toItemTypeInfoList('${detailListItem.itemId }','${detailList.redemptionId }','${list.id }')" id="itemDescription${list.id }${detailList.redemptionId }${detailListItem.itemId }" readonly>
																</core:if>
															</td>
															<td align="center" width="60">${detailListItem.quantity}</td>
															<td align="center" width="60">${detailListItem.price ne null ? '￥':''}${detailListItem.price}</td>
														</tr>
													</core:forEach>
															</table>
														</td>
													</tr>
													
												</core:forEach>
											</core:when>
											<core:when test="${list.hasUsed}">
												<tr>
													<th width="105px">已用项目</th>
													<th width="125px">描述</th>
													<th width="130px">可使用次数</th>
													<th width="200px">使用日期</th>
													<th width="80px"></th>
												</tr>
												<core:forEach
													items="${list.memberUsedPackageRedemptionList}"
													var="usedDetailList">
													<tr>
														<td class="align_w hasUsed" align="left">${usedDetailList[2]}</td>
														<td class="align_w hasUsed" align="left">${usedDetailList[3]}</td>
														<td class="align_w hasUsed" align="right"
															style="padding-right: 40px;">${usedDetailList[4]}</td>
														<td class="align_w hasUsed" align="left"><fmt:formatDate
																value="${usedDetailList[6]}"
																pattern="yyyy-MM-dd HH:mm:ss" var="redeemDate" />
															${fn:substring(redeemDate, 0, 10)}</td>
														<td class="align_w hasUsed"></td>
													</tr>
												</core:forEach>
											</core:when>
										</core:choose>
									</table>
								</td>
								</tr>
							</core:forEach>
						</tbody>
					</table>
					<div class="spliter h_10"></div>
					<div id="msg" style="color:red;width:800px; margin-left:200px;font-size:14px;"></div>
					<div class="spliter h_10"></div>
					<div class="btn_div" style="width: 1000px">
						<button type="button" class="btn"
							style="width: 80px; height: 30px" id="redeemItems">使用</button>
					</div>
				</form:form>
			</div>
		</div>
	</div>
</body>
</html>